
export const ClientStorage = {
  get: (...args) => {
    const storage = {}
    args.forEach(arg => {
      storage[arg] = window.localStorage.getItem(arg) || null
    })
    return storage
  },

  set: data => {
    // console.log('set', data)
    Object.keys(data).forEach(prop => {
      const el = data[prop]
      window.localStorage.setItem(prop, el)
    })
  },

  remove: (...args) => {
    args.forEach(arg => {
      window.localStorage.removeItem(arg)
    })
  },

  has: (key) => {
    return !!window.localStorage.getItem(key)
  }
}
export const SessionStorage = {
  get: (...args) => {
    const storage = {}
    args.forEach(arg => {
      storage[arg] = window.sessionStorage.getItem(arg) || null
    })
    return storage
  },

  set: data => {
    Object.keys(data).forEach(prop => {
      const el = data[prop]
      window.sessionStorage.setItem(prop, el)
    })
  },

  remove: (...args) => {
    args.forEach(arg => {
      window.sessionStorage.removeItem(arg)
    })
  },

  has: (key) => {
    return !!window.sessionStorage.getItem(key)
  }
}
